package view;

	import java.awt.BorderLayout;
	import java.awt.Color;
	import java.awt.Rectangle;

	import javax.swing.*;
	import javax.swing.border.TitledBorder;

	import java.awt.event.ActionListener;


	/**
	 * This is the Notification Details GUI extends AbstractGUI 
	 * @author Tal Panika	
	 */ 
	public class NotificationDetailsGUI  extends AbstractGUI
	{
		
		
		private JTextArea complaintArea = null;
		private JLabel ReplyLabel = null;
		private JTextArea ReplyTextArea = null;
		private JButton checkButton = null;
		private JPanel contentPane=null;
		private JLabel wrnMessage=null;
		

		/**
		 * This is NotificationDetailsGUI constructor.
		 * 
		 */
		public NotificationDetailsGUI ()
		{ 		  
			 //Complain tDetails panel
			   contentPane=new JPanel();	
			  //Main Panel 
			   contentPane.setBorder(new TitledBorder(null, "Your Feedback", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			   contentPane.setLayout(null);
			   contentPane.setOpaque(true);
			
			
			   contentPane.add(getComplaintArea());
				contentPane.add(getReplyLabel());
				contentPane.add(getReplyArea());
				contentPane.add(getCheckButton());
				contentPane.add(getBackButton(),BorderLayout.SOUTH);
				contentPane.add(getWrnMessage());
		        

				  //Frame
			        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
			        this.setTitle("Notification Details Window");
			        this.setContentPane(contentPane);  
				    this.setLocationRelativeTo(null); //This will center the JFrame in the middle of the screen
			        this.setLocationByPlatform(true);
			        this.setSize(500, 465);         
		               
		  }
		

		
		
		/**
		 * This method initializes Reply Label
		 */
		private JLabel getReplyLabel() {
			if (ReplyLabel == null) {
				ReplyLabel = new JLabel();
				ReplyLabel.setBounds(new Rectangle(56, 172, 219, 17));
				   SetGenLabel("Reply From Customer Service",ReplyLabel);
			}
			return ReplyLabel;
		}
		
		

		
		
		/**
		 * This method initializes Compliant Details Area
		 */
		private JTextArea getComplaintArea() {
			if (complaintArea == null) {
				complaintArea = new JTextArea();
				complaintArea.setBounds(new Rectangle(50, 70, 350, 100));
				complaintArea.setBorder(BorderFactory.createLineBorder(Color.BLACK));
				
			}
			return complaintArea;
		}
		
		/**
		 * This method initializes Reply Area	
		 */
		private JTextArea getReplyArea() {
			if (ReplyTextArea == null) {
				ReplyTextArea = new JTextArea();			
				ReplyTextArea.setBounds(new Rectangle(50, 200, 350, 100));
				ReplyTextArea.setBorder(BorderFactory.createLineBorder(Color.BLACK));
				
			}
			return ReplyTextArea;
		}
		
		/**
		 * This method initializes Send Check Button	
		 */
		private JButton getCheckButton() {
			if (checkButton == null) {
				checkButton = new JButton();
				checkButton.setBounds(new Rectangle(70, 320, 100, 35));
				checkButton.setText("OK");
				
			}
			return checkButton;
		}
			

		/**
		 * This method creates warning message if currently is null.
		 * @return JLabel type.
		 */
		private JLabel getWrnMessage() {
			if (wrnMessage == null) {
				wrnMessage = new JLabel();
				wrnMessage.setForeground(Color.RED);
				wrnMessage.setBounds(70, 16, 320, 23);
				wrnMessage.setVisible(false);
			}
			return wrnMessage;
		}
		
		/**
		 * This method initializes Back Button	
		 */
		private JButton getBackButton() {
			if (backButton == null) {
				backButton = new JButton();
				backButton.setBounds(new Rectangle(260, 320, 100, 35));
				backButton.setText("Back");
			
			}
			return backButton;
		}
		
		
		

		/**
		 * *********************************Public Methods 
		 */
		
		/**
		 * This method display Warning Message.
		 * @param void	 
		 * */
		
		public void displayWrnMessage(String msg){
			wrnMessage.setText(msg);
			wrnMessage.setVisible(true);
		}
		
		
		
		/**
		 * This method set JLablel Text genric
		 */
		public void SetGenLabel(String text,JLabel label) {
			if (label != null) {

				label.setText(text);
			}
		}
		
		/**
		 * This set complaintField Area.
		 * @param String Msg 
		 * */
		
		public void setComplaintDetArea(String msg){
			complaintArea.setText(msg);
			complaintArea.setVisible(true);
		}
		

		/**
		 * This set ReplytField Area.
		 * @param String Msg 
		 * */
		
		public void setReplyArea(String msg){
			ReplyTextArea.setText(msg);
			ReplyTextArea.setVisible(true);
		}
		
		
		/**
		 * This method return Reply Area
		 */
		public String getReply() {
			return ReplyTextArea.getText();
		}
		
		
		/**
		 * This method add action listener to Check button.
		 * @param listener
		 */
		public void addcheckActionListener(ActionListener listener){
			checkButton.addActionListener(listener);
		}
		
		
		/**
		 * This method return -simulate back button pressed .
		 * @param listener
		 */
		public void clickBackButton()
		{
			this.getBackButton().doClick();
		}
}
